package com.xyhy.starter.web.hutool;

import cn.hutool.core.convert.ConverterRegistry;

import jakarta.annotation.PostConstruct;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

/**
 * hutool converter --robert
 * BeanUtil.mapToBean不支持LocalDateTime等jdk8的时间格式
 * https://gitee.com/dromara/hutool/issues/IML95
 */
public class HutoolConfig {

  @PostConstruct
  private void init() {
    ConverterRegistry converterRegistry = ConverterRegistry.getInstance();
    converterRegistry.putCustom(LocalDate.class, LocalDateConverter.class);
    converterRegistry.putCustom(LocalTime.class, LocalTimeConverter.class);
    converterRegistry.putCustom(LocalDateTime.class, LocalDateTimeConverter.class);
  }


}
